package com.infore.airsupervise.utils;

import android.view.animation.LinearInterpolator;

import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.animation.AlphaAnimation;
import com.amap.api.maps.model.animation.Animation;
import com.amap.api.maps.model.animation.AnimationSet;
import com.amap.api.maps.model.animation.ScaleAnimation;

/**
 * @features: 地图一些功能的工具类
 * @author: WuTao
 * @date: 2017/4/26 11:21
 */
public class AmapUtil {

    /**
     * 地上生长的Marker
     */
    public  static void startGrowAnimation(Marker marker) {
        if(marker != null) {
            AnimationSet animationSet = new AnimationSet(true);
            Animation animation = new ScaleAnimation(0,1,0,1);
            Animation animation1 = new AlphaAnimation(0,1);
            animationSet.addAnimation(animation);
            animationSet.addAnimation(animation1);
            animationSet.setInterpolator(new LinearInterpolator());
            //整个移动所需要的时间
            animationSet.setDuration(1000);
            //设置动画
            marker.setAnimation(animationSet);
            //开始动画
            marker.startAnimation();
        }
    }
}
